<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <cpn1></cpn1>
    <cpn2></cpn2>
  </div>
  <!-- 组件模板的分离写法 -->
  <!-- 1. script标签写法 -->
  <script type="text/x-template" id="cpn1">
    <div>
      <h2>我是标题111</h2>
      <p>我是内容,哈哈哈哈哈</p>
    </div>
  </script>
  <!-- 2. template标签写法 -->
  <template id="cpn2">
    <div>
      <h2>我是标题222</h2>
      <p>我是内容,呵呵呵呵呵</p>
    </div>
  </template>

  <script>
    // 将定义的模板的id绑定到标签名中
    Vue.component('cpn1', {
      template: "#cpn1"
    })
    Vue.component('cpn2', {
      template: "#cpn2"
    })
    const app = new Vue({
      el: "#app"
    })
  </script>
</body>

</html>